const {
  defineConfig
} = require('@vue/cli-service')
const Mock = require("mockjs")

function getList() {
  return Mock.mock({
    "list|10": [{
      "img": "@image(100x100,@color)",
      "title": "@ctitle"
    }]
  }).list
}

function addList() {
  return Mock.mock({
    "list|5": [{
      "img": "@image(100x100,@color)",
      "title": "@ctitle"
    }]
  }).list
}
module.exports = defineConfig({
  transpileDependencies: true,
  devServer: {
    onBeforeSetupMiddleware({
      app
    }) {
      app.get("/getlist", (req, res) => {
        res.send(getList())
      })
      app.get("/addlist", (req, res) => {
        res.send(addList())
      })
    }
  }


})